<me:UIBGA x:Class="WPFExcelReport.TBASTGA"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT" 
                      xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    xmlns:TXT="clr-namespace:WPFExcelReport;assembly=TTXTIND"  
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIBGA.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:NOTConverter  x:Key="not"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter x:Key="nbv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIBGA.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" >
            <WrapPanel  Grid.Row="0">
                 <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                              IsEnabled="{Binding IsCanNew,ElementName=TV}"
                              >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20"
                             IsEnabled="{Binding IsCanChg,ElementName=TV}"
                             >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanDelete,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" IsEnabled="{Binding IsCanCopy,ElementName=TV}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24"
                               IsEnabled="{Binding IsCanCopy,ElementName=TV}"
                               >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
               
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=品种:}}"></TextBlock>
                    <ex:TXT72 MaxLength="40" Grid.Column="1" CharacterCasing="Upper" 
                              Text="{Binding ART,ElementName=TV, Converter={StaticResource gb2312}}" Width="200" />
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                        </Button.Background>
                    </Button>
                </Grid>
            </WrapPanel>
        </StackPanel>
        <DataGrid  Grid.Row="1"  
                   VerticalAlignment="Top" 
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto"
                   HeadersVisibility="Column"  
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True" 
                   IsReadOnly="True"
                   x:Name="dlgMaster" 
                   RowDetailsVisibilityMode="Visible"  
                >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=BAGART}" Header="{Binding Source={Localization:Translate Word=轴}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGFARBE, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=色路}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGPOS, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=行}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGGART, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=纱}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGGVAR, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=var}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGGFARBE, Converter={StaticResource gb2312}}"   Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGFDZ, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=根数}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGABF, Converter={StaticResource gb2312}}" Header="{Binding Source={Localization:Translate Word=损耗}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGKGNET}" Header="{Binding Source={Localization:Translate Word=净重}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGKGBRUT}" Header="{Binding Source={Localization:Translate Word=毛重}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGDISPOKZ}" Header="{Binding Source={Localization:Translate Word=受控}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGBEM}" Header="{Binding Source={Localization:Translate Word=备注}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=BAGAUFMSL}" Header="{Binding Source={Localization:Translate Word=包装}}"  Width="Auto" />
            </DataGrid.Columns>
        </DataGrid  >
      <me:TBS08
          IsEdit="{Binding IsEdit,ElementName=TV}"
          IsSaved="{Binding IsSaved,ElementName=TV}"  
          />
    </Grid>
</me:UIBGA>

    
